var e = require;
var t = module;
var n = exports;
"use strict";
var o, i = this && this.__extends || (o = function (e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function (e, t) { e.__proto__ = t } ||
        function (e, t) {
            for (var n in t)
                Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n])
        })(e, t)
}, function (e, t) {
    function n() {
        this.constructor = e
    } o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
}),
    r = this && this.__decorate || function (e, t, n, o) {
        var i, r = arguments.length, y = r < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) y = Reflect.decorate(e, t, n, o);
        else for (var a = e.length - 1; 0 <= a; a--)(i = e[a]) && (y = (r < 3 ? i(y) : 3 < r ? i(t, n, y) : i(t, n)) || y);
        return 3 < r && y && Object.defineProperty(t, n, y), y
    };
Object.defineProperty(n, "__esModule", { value: !0 }); var y, a = e("BaseUI"), s = e("RecycleScroll"), c = e("AudioConst"), x = e("EventConst"), l = e("PlatformConst"), h = e("SceneConst"), d = e("UserConst"), u = e("AudioManager"), f = e("EventManager"), p = e("PlatformManager"), g = e("ResManager"), m = e("SceneManager"), v = e("UserManager"), b = e("LevelSelectItem"), _ = e("ConfigUtils"), w = e("XMADUtils"), t = cc._decorator, e = t.ccclass, t = t.property, e = (y = a.default, i(C, y), C.prototype.onLoad = function () { y.prototype.onLoad.call(this), this.initView() },
    C.prototype.onEnable = function () {
        f.Event.on(x.default.CLICK_BACK, this.clickBack, this),
            p.Platform.is(l.EPlatform.XIAOMI_ANDROID) && w.XMAD.showBannerFeed()
    }, C.prototype.onDisable = function () {
        f.Event.off(x.default.CLICK_BACK, this.clickBack, this),
            p.Platform.is(l.EPlatform.XIAOMI_ANDROID) && (p.Platform.removeBannerFeed(),
                p.Platform.hideBanner())
    }, C.prototype.initView = function () {
        var t, n = this, e = v.User.getTempData(d.TempData.CURRENT_MODE),
            o = v.User.get(d.UserData.LEVEL_LIST),
            i = 1; o[e] &&
                (i = o[e], this.currentUnlockLevel = i),
                cc.resources.load("texture/banner/" + e, function (e, t) {
                    return e ? console.log(e) : void (n.dict.icon.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t))
                }),
                _.ConfigUtils.getDataByID(e, function (e) {
                    console.log("res - ", e),
                        (t = e.amount) <= i && (i = t),
                        n.dict.name.getComponent(cc.Label).string = e.themeName,
                        n.dict.level.getComponent(cc.Label).string = i + "/" + t,
                        n.scroll.onItemRender = n.onItemRender.bind(n),
                        n.scroll.onItemClicked = n.onItemClicked.bind(n),
                        n.scroll.numItems = t
                }),
                g.Res.load("prefab/item/TopBar").then(function (e) {
                    console.log("测试加载");
                    e = cc.instantiate(e); n.node.addChild(e)
                }), u.Audio.playMusic(c.AudioConst.BGM_MAIN)
    },
    C.prototype.onItemRender = function (e, t) {
        t = t.getComponent(b.default),
            b.default.state.Normal, e = {
                index: e, currentLevel: this.currentUnlockLevel
            }; t.setData(e)
    }, C.prototype.onItemClicked = function () { },
    C.prototype.clickBack = function () {
        cc.game.emit("gamelog", "btn008"),
            m.Scene.loadScene(h.SceneConst.MAIN)

        window.__prv.doAction('返回到主页面强弹视频', ['hw']);
    },
    r([t(s.default)], C.prototype, "scroll", void 0), r([e], C)); function C() { var e = null !== y && y.apply(this, arguments) || this; return e.scroll = null, e._data = null, e.itemsData = [], e.childrenLength = 6, e.currentUnlockLevel = 1, e } n.default = e